package com.region.http.client.model;

import java.io.File;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

/**
 * Multi-file transfer wrapper object
 *
 * @author liujieyu
 * @date 2023/6/18 19:39
 * @desciption
 */
public class MultiFileTransferMeta {

    private Map<String, Object> parameters;

    private MultiFileTransferMeta(Map<String, Object> parameters) {
        this.parameters = parameters;
    }

    public Map<String, Object> getParameters() {
        return parameters;
    }

    public static MultiFileTransferMetaBuilder builder() {
        return new MultiFileTransferMetaBuilder();
    }

    public static final class MultiFileTransferMetaBuilder {

        private Map<String, Object> parameters = new HashMap<>();

        private MultiFileTransferMetaBuilder() {}

        public MultiFileTransferMetaBuilder addFile(File file) {
            parameters.put(file.getName(), file);
            return this;
        }

        public MultiFileTransferMetaBuilder addBytes(String name, byte[] bytes) {
            parameters.put(name, bytes);
            return this;
        }

        public MultiFileTransferMetaBuilder addInputStream(String name, InputStream inputStream) {
            parameters.put(name, inputStream);
            return this;
        }

        public MultiFileTransferMeta build() {
            return new MultiFileTransferMeta(parameters);
        }

    }

}
